<?php
//文件上传接口，前后台共用
Route::post('uploadImg', 'PublicController@uploadImg')->name('uploadImg');
//发送短信
Route::post('/sendMsg', 'PublicController@sendMsg')->name('sendMsg');

//支付
Route::group(['namespace' => 'Home'], function () {
    //微信支付
    Route::get('/wechatPay', 'PayController@wechatPay')->name('wechatPay');
    //微信支付回调
    Route::post('/wechatNotify', 'PayController@wechatNotify')->name('wechatNofity');
});

//会员-不需要认证
Route::group(['namespace'=>'Home','prefix'=>'member'],function (){
    //注册
    Route::get('register', 'MemberController@showRegisterForm')->name('home.member.showRegisterForm');
    Route::post('register', 'MemberController@register')->name('home.member.register');
    //登录
    Route::get('login', 'MemberController@showLoginForm')->name('home.member.showLoginForm');
    Route::post('login', 'MemberController@userLogin')->name('home.member.login');
});
//会员-需要认证
Route::group(['namespace'=>'Home','prefix'=>'member','middleware'=>'member'],function (){
    //个人中心
    Route::get('/','MemberController@index')->name('home.member');
    //退出
    Route::get('logout', 'MemberController@logout')->name('home.member.logout');
});

// 前台页面
Route::group(['namespace'=>'Home'],function (){
    // 楼盘
    Route::get('/','IndexController@index')->name('home');
    Route::post('/indexData','IndexController@getData')->name('home.getData');
    Route::post('/getAverageData','IndexController@getAverageData')->name('home.getAverageData');
    Route::post('/getMenu','IndexController@getMenu')->name('home.getMenu');

    Route::get('/newhouse/{id}', 'PropertyController@index')->name('home.property');
    Route::post('/property/data', 'PropertyController@data')->name('home.property.data');
    Route::get('/property/map', 'PropertyController@getMapPosition')->name('home.property.map');
    Route::get('/property/{id}', 'PropertyController@show')->name('home.property.show');
    //获取区域及地铁
    Route::post('/region/city', 'RegionController@getCityAndMetro')->name('home.region.city');
    Route::post('/region/cityArea', 'RegionController@getCityArea')->name('home.region.cityArea');
    Route::post('/region/metroStation', 'RegionController@getMetroStation')->name('home.region.metroStation');
    // 二手房
    Route::get('/hand/{id}', 'HandroomController@index')->name('home.handroom');
    Route::post('/handroom/data', 'HandroomController@data')->name('home.handroom.data');
    Route::get('/handroom/{id}', 'HandroomController@show')->name('home.handroom.show');
    // 小区
    Route::get('/community/{id}', 'CommunityController@index')->name('home.community');
    Route::post('/community/data', 'CommunityController@data')->name('home.community.data');
    Route::get('/residential/{id}', 'CommunityController@show')->name('home.community.show');
    Route::get('/community/hand/{id}', 'CommunityController@handRoom')->name('home.community.handRoom');
    Route::post('/community/hand/data', 'CommunityController@getCommunityHandRoom')->name('home.community.hand.data');
    Route::get('/community/rental/{id}', 'CommunityController@rentalHouse')->name('home.community.rentalHouse');
    Route::post('/community/rental/data', 'CommunityController@getCommunityRentalHouse')->name('home.community.rental.data');
    // 租房
    Route::get('/rental/{id}', 'RentalhouseController@index')->name('home.rentalhouse');
    Route::post('/rentalhouse/data', 'RentalhouseController@data')->name('home.rentalhouse.data');
    Route::get('/rentalhouse/{id}', 'RentalhouseController@show')->name('home.rentalhouse.show');
    // 资讯
    Route::get('/list/{city}', 'ArticleController@index')->name('home.article');
    Route::get('/article/{city}/{id}', 'ArticleController@show')->name('home.article.show');
    // 地图找房
    Route::get('/maproom', 'MaproomController@mapFindingRoom')->name('home.maproom');
    Route::post('/maproom/data', 'MaproomController@getMapRoomData')->name('home.maproom.data');
    Route::post('/maproom/alldata', 'MaproomController@getMapRoomAllData')->name('home.maproom.alldata');
    Route::post('/maproom/scrolldata', 'MaproomController@getMapRoomScrollData')->name('home.maproom.scrolldata');
    Route::post('/maproom/scrollAreaData', 'MaproomController@getMapAreaScrollData')->name('home.maproom.scrolldata');
    Route::post('/maproom/initArea', 'MaproomController@initArea')->name('home.maproom.initarea');
    // 留言找房
    Route::post('/findhouse', 'MessageController@saveFindHouseInfo')->name('home.findhouse');
    Route::post('/checkCaptcha', 'MessageController@checkCaptcha')->name('home.checkCaptcha');
    //发送验证码
    Route::post('/saveViewHouse', 'MessageController@saveViewHouse')->name('home.saveViewHouse');
});
